<template>
  <div class="main">
    <div class="item">
      <el-row>
        <el-col :span="8" class="item-label">姓名:</el-col>
        <el-col :span="16" class="item-content">{{store.state.personalInfo.name}}</el-col>
      </el-row>
    </div>
    <div class="item">
      <el-row>
        <el-col :span="8" class="item-label">性别:</el-col>
        <el-col :span="16" class="item-content">{{store.state.personalInfo.sex === 0 ? '男' : '女'}}</el-col>
      </el-row>
    </div>
    <div class="item">
      <el-row>
        <el-col :span="8" class="item-label">年龄:</el-col>
        <el-col :span="16" class="item-content">{{store.state.personalInfo.age}}</el-col>
      </el-row>
    </div>
    <div class="item">
      <el-row>
        <el-col :span="8" class="item-label">身份证号码:</el-col>
        <el-col :span="16" class="item-content">{{store.state.personalInfo.idCardNo}}</el-col>
      </el-row>
    </div>
    <div class="item" v-if="store.state.personalInfo.icCardNo">
      <el-row>
        <el-col :span="8" class="item-label">社保卡号:</el-col>
        <el-col :span="16" class="item-content">{{store.state.personalInfo.icCardNo}}</el-col>
      </el-row>
    </div>
    <div class="item" v-if="store.state.personalInfo.address">
      <el-row>
        <el-col :span="8" class="item-label">地址:</el-col>
        <el-col :span="16" class="item-content">{{store.state.personalInfo.address}}</el-col>
      </el-row>
    </div>
    <div class="btns">
      <div class="btn" @click="reg()">建档</div>
    </div>
  </div>
</template>

<script lang="ts">
import { Component } from 'vue-property-decorator'
import { mixins } from 'vue-class-component'
import BaseMixin from '@/mixins/base'

@Component
export default class Create extends mixins(BaseMixin) {
  private async created () {
    this.client = this.store.state.client
    this.setTip('请确认您的建档信息')
    this.setMaxTime(60)
    this.updateTimeHandler('home')
  }

  // 注册
  private async reg () {
    this.showLoading('正在建档中..')
    this.timer(3)
  }

  private timer (second: number) {
    setTimeout(() => {
      this.showLoading(`建档成功, ${second}秒钟后自动返回`)
      if (second > 0) {
        second--
        this.timer(second)
      } else {
        this.hideLoading()
        this.home()
      }
    }, 1000)
  }
}

</script>

<style scoped>
  .main{
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    align-content: center;
    flex-direction: column;
    background: white;
    width: 80%;
    margin: 0 auto;
    border-radius: 1rem;
    box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    padding-top: 4rem;
  }
  .item{
    width: 100%;
    font-size: 2.5rem;
    line-height: 6rem;
  }
  .item-label{
    text-align: right;
    padding-right: 1rem;
  }
  .item-content{
    text-align: left;
    color: #01D8A0;
  }
  .btns{
    margin: 0 auto;
    text-align: center;
  }
  .btn{
    width: 10rem;
    height: 4rem;
    font-size: 2.5rem;
    line-height: 4rem;
    border-radius: 4rem;
    background-color: #01D8A0;
    color: white;
    padding: 1rem;
    margin: 2rem auto;
  }
</style>
